#define _CRT_SECURE_NO_WARNINGS 
#include <stdio.h>
int n, r;
int a[21];
void yzc(int q)
{
	if (q > r)
	{
		for (int i = 1; i <= r; i++) {
			printf(" %d ", a[i]);
		}
		printf("\n");
		return;
	}
	for (int i = a[q - 1] + 1; i <= n; i++) {
		a[q] = i;
		yzc(q + 1);
	}
}
int main()
{
	scanf("%d%d", &n, &r);
	yzc(1);
	return 0;
}